import React from "react"

import { List } from 'antd-mobile';

import {getMemory,getDj} from "../../api"

import {withRouter} from "react-router-dom";

const Item = List.Item;
const Brief = Item.Brief;

class ListExample extends React.Component {
  state = {
    disabled: false,
  }

  constructor(){
    super()
    this.state = {
      Memory:[],
      Diantai:[],
      Dj_count:0
    }
  }

  componentDidMount(){
    let uid = localStorage.getItem("uId")
    console.log(uid);
    
  //   fetch("http://106.12.79.128:666/user/record?uid=66982236&type=0")
  // .then(body=>body.json())
  // .then(res=>{
  //   console.log(res);
  //   this.setState({
  //     Memory:res.allData
  //   })
  //   console.log(this.state.Memory);
    
  // })

  // fetch("http://106.12.79.128:666/dj/sublist?uid=66982236")
  // .then(body=>body.json())
  // .then(res=>{
  //   console.log(res);
  //   this.setState({
  //     Diantai:res.djRadios
  //   })
  //   console.log(this.state.Diantai);
    
  // })
  
  // login1()
  // .then(body=>body.json())
  // .then(res=>{
  //   console.log(res);
  // getMemory(res.account.id)
  // .then(body=>body.json())
  // .then(res=>{
  //   // console.log(res);
  //     this.setState({
  //     Memory:res.allData
  //   })
  //   // console.log(this.state.Memory);
  // })
  // })


  getMemory(uid)
  .then(body=>body.json())
  .then(res=>{
    // console.log(res);
      this.setState({
      Memory:res.allData
    })
    // console.log(this.state.Memory);
  })

  getDj()
  .then(body=>body.json())
  .then(res=>{
    console.log(res);
      this.setState({
        Dj_count:res.count,
        Diantai:res.djRadios
    })
    console.log(this.state.Dj_count);
  })
  
    
  }
  render() {

    
    return (<div>

 
      <List>
        <Item
          thumb="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573831425614&di=fa74e4b50d23e8b96954e8ec479028e1&imgtype=0&src=http%3A%2F%2Fpic.51yuansu.com%2Fpic3%2Fcover%2F01%2F02%2F06%2F58de8d4001b91_610.jpg"
          arrow="horizontal"
          onClick={(props) => {
            console.log(props);
            // this.props.history.push({pathname:"/discover"});
            this.props.history.push({pathname:"/my/bendi"});
          }}
        >本地音乐<span style={{marginLeft:"5rem",fontSize:"10px",display:"inline"}}>2</span></Item>
        <Item
          thumb="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573831207328&di=653b19ba53833e6035e6b5cedc0de1bc&imgtype=0&src=http%3A%2F%2Fpic.51yuansu.com%2Fpic2%2Fcover%2F00%2F35%2F69%2F5811ad0bccda0_610.jpg"
          onClick={(props) => {
            this.props.history.push({pathname:"/my/zuijing"})
          }}
          arrow="horizontal"
        >
          {/* <svg t="1573810035452" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="879" width="30" height="30"><path d="M483.555556 483.555556v-284.444445a28.444444 28.444444 0 0 1 56.888888 0v284.444445h284.444445a28.444444 28.444444 0 1 1 0 56.888888h-284.444445v284.444445a28.444444 28.444444 0 1 1-56.888888 0v-284.444445h-284.444445a28.444444 28.444444 0 0 1 0-56.888888h284.444445z" fill="#5A6677" p-id="880"></path></svg> */}
        最近播放<span style={{marginLeft:"4.7rem",fontSize:"10px",display:"inline"}}>{this.state.Memory.length}</span>
        </Item>
        <Item
          thumb="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573831345001&di=3d476f96d2423838d4bfd48c1b504273&imgtype=0&src=http%3A%2F%2Fpic.51yuansu.com%2Fpic2%2Fcover%2F00%2F50%2F72%2F5816603cd09cb_610.jpg"
          onClick={(props) => {
            this.props.history.push({pathname:"my/diantai"})
          }}
          arrow="horizontal"
        >
          我的电台<span style={{marginLeft:"5rem",fontSize:"10px",display:"inline"}}>{this.state.Dj_count}</span>
        </Item>
        <Item
          thumb="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573831398557&di=b02bb8082ec9489d358aa2b4e62135e0&imgtype=0&src=http%3A%2F%2Fku.90sjimg.com%2Felement_origin_min_pic%2F01%2F38%2F44%2F69573c852644792.jpg"
          onClick={(props) => {
            this.props.history.push({pathname:"/my/shoucang"});

          }}
          arrow="horizontal"
        >
          我的收藏<span style={{marginLeft:"2.5rem",fontSize:"10px",display:"inline"}}>专辑/视频/歌手/专栏/Mlog</span>
        </Item>
      </List>


    </div>);
  }
}

export default withRouter(ListExample)